import { ChainId } from '@uniswap/sdk';
import { Configuration } from './basis-cash/config';
import { BankInfo } from './basis-cash';
import { formatUnits } from 'ethers/lib/utils';
import { BigNumber } from 'ethers';


const configurations: { [env: string]: Configuration } = {
  development: {
    chainId: 128, //ChainId.MAINNET,
    etherscanUrl: 'https://hecoinfo.com/',
    defaultProvider: 'https://http-mainnet.hecochain.com',
    deployments: require('./basis-cash/deployments/deployments.heco_new.json'),
    externalTokens: {
      ESP: ['0x068639ccdadee363c7178bb08fbf8f6d868751b5', 18],
      SHARE:  ['0x41198c6736d23734E6d17a6F0B4f2D15d2621A3a',  18], 
      USDTHECO: ['0xa71edc38d189767582c38a3145b5873052c3e47a', 18],
      'ESC_USDTHECO-MDEX-LP': ['0x33FBf95509ea1656be1F388647C18414BaBE932f', 18],
      'ESS_USDTHECO-MDEX-LP': ['0xB83027A702c12dD0FCdC57e2E8b8E5673718d095', 18],
      'ESC_ESP-MDEX-LP': ['0x28C244bCb59bf5600D4995F6D81CAdf0dEF3315f', 18],
      'ESS_ESP-MDEX-LP': ['0x00E8595A87259D02c9207A9c352e6131D688389B', 18],
      'ESP_USDT-MDEX-LP': ['0xd1ce44d74a9015db43290ff951c6e26355301350', 18],
      'ESC' : ['0x884C5A83D27f14020dd70cF580B0a813bd3282fC', 18],
      'ESS' : ['0x8c1dB81b742De0E7f4C159C5e55da5F77Ce0039c', 18],
    },
    baseLaunchDate: new Date('2021-01-31T00:00:00Z'),
    bondLaunchesAt: new Date('2021-01-31T00:00:00Z'),
    boardroomLaunchesAt: new Date('2021-01-31T00:00:00Z'),
    refreshInterval: 30000,
    gasLimitMultiplier: 1.7,
  },
  production: {
    chainId: 128, //ChainId.MAINNET,
    etherscanUrl: 'https://hecoinfo.com/',
    defaultProvider: 'https://http-mainnet.hecochain.com',
    deployments: require('./basis-cash/deployments/deployments.heco_new.json'),
    externalTokens: {
      ESP: ['0x068639ccdadee363c7178bb08fbf8f6d868751b5', 18],
      SHARE:  ['0x41198c6736d23734E6d17a6F0B4f2D15d2621A3a',  18], 
      USDTHECO: ['0xa71edc38d189767582c38a3145b5873052c3e47a', 18],
      'ESC_USDTHECO-MDEX-LP': ['0x33FBf95509ea1656be1F388647C18414BaBE932f', 18],
      'ESS_USDTHECO-MDEX-LP': ['0xB83027A702c12dD0FCdC57e2E8b8E5673718d095', 18],
      'ESC_ESP-MDEX-LP': ['0x28C244bCb59bf5600D4995F6D81CAdf0dEF3315f', 18],
      'ESS_ESP-MDEX-LP': ['0x00E8595A87259D02c9207A9c352e6131D688389B', 18],
      'ESP_USDT-MDEX-LP': ['0xd1ce44d74a9015db43290ff951c6e26355301350', 18],
      'ESC' : ['0x884C5A83D27f14020dd70cF580B0a813bd3282fC', 18],
      'ESS' : ['0x8c1dB81b742De0E7f4C159C5e55da5F77Ce0039c', 18],
    },
    baseLaunchDate: new Date('2021-02-01T00:00:00Z'),
    bondLaunchesAt: new Date('2021-02-10T00:00:00Z'),
    boardroomLaunchesAt: new Date('2021-02-09T00:00:00Z'),
    refreshInterval: 30000,
    gasLimitMultiplier: 1.7,
  },
};

export const bankDefinitions: { [contractName: string]: BankInfo } = {
  USDTHECOESCLPTokenSharePool: {
    name: '使用 ESC_USDTHECO-MDEX-LP 賺取 ESS',
    contract: 'USDTHECOESCLPTokenSharePool',
    depositTokenName: 'ESC_USDTHECO-MDEX-LP',
    earnTokenName: 'ESS',
    finished: false,
    sort: 4,
  },
  USDTHECOESSLPTokenSharePool: {
    name: '存入 ESS_USDTHECO-MDEX-LP 赚取 ESS',
    contract: 'USDTHECOESSLPTokenSharePool',
    depositTokenName: 'ESS_USDTHECO-MDEX-LP',
    earnTokenName: 'ESS',
    finished: false,
    sort: 5,
  },
  ESCESPPool: {
    name: '存入 ESP 赚取 ESC（80%返还 (满)）',
    contract: 'ESCESPPool',
    depositTokenName: 'ESP',
    earnTokenName: 'ESC',
    finished: true,
    sort: 0,
  },
  ESCESPPool2: {
    name: '存入 ESP 赚取 ESC（270天 60%返还(开放)）',
    contract: 'ESCESPPool2',
    depositTokenName: 'ESP',
    earnTokenName: 'ESC',
    finished: true,
    sort: 0,
  },
  ESCESPPool3: {
    name: '存入 ESP 赚取 ESC（180天  40%返还(开放)）',
    contract: 'ESCESPPool3',
    depositTokenName: 'ESP',
    earnTokenName: 'ESC',
    finished: true,
    sort: 0,
  },
  ESPESCLPTokenSharePool: {
    name: '存入 ESC-ESP-LP 赚取 ESS',
    contract: 'ESPESCLPTokenSharePool',
    depositTokenName: 'ESC_ESP-MDEX-LP',
    earnTokenName: 'ESS',
    finished: false,
    sort: 6,
  },
  ESPESSLPTokenSharePool: {
    name: '存入 ESS-ESP-LP 赚取 ESS',
    contract: 'ESPESSLPTokenSharePool',
    depositTokenName: 'ESS_ESP-MDEX-LP',
    earnTokenName: 'ESS',
    finished: false,
    sort: 7,
  },
  USDTHECOESPLPTokenSharePool4: {
    name: '存入 ESP-USDT-LP 赚取 ESS',
    contract: 'USDTHECOESPLPTokenSharePool4',
    depositTokenName: 'ESP_USDT-MDEX-LP',
    earnTokenName: 'ESS',
    finished: false,
    sort: 8,
  },
  USDTHECOESCLPTokenSharePool4: {
    name: '使用 ESC_USDTHECO-MDEX-LP 賺取 ESS(2池)',
    contract: 'USDTHECOESCLPTokenSharePool4',
    depositTokenName: 'ESC_USDTHECO-MDEX-LP',
    earnTokenName: 'ESS',
    finished: false,
    sort: 9,
  },

  sCASH_ESC_pool: {
    name: '使用ESC 换取 sCASH',
    contract: 'sCASH_ESC_pool',
    depositTokenName: 'ESC',
    earnTokenName: 'sCASH',
    finished: false,
    group: 'jinku',
    sort: 12,
  },
  SHARE_ESS_pool: {
    name: '使用ESS 换取 sCASH',
    contract: 'SHARE_ESS_pool',
    depositTokenName: 'ESS',
    earnTokenName: 'SHARE',
    finished: false,
    group: 'jinku',
    sort: 13,
  },
};

export default configurations[process.env.NODE_ENV || "development"];
